<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        //
        var person={"name":"张三","age":22,"gender":true};
        for (var key in person) {
            //不能使用person.key，在这里key只是字符串
            alert(key+":"+person[key]);
        }
        //
        var person1=[
            {"name":"张三","age":22,"gender":true},
            {"name":"李四","age":22,"gender":true},
            {"name":"王五","age":22,"gender":true}
        ]
        for (var i = 0; i < person1.length; i++) {
            var p=person1[i];
            for (var person1Key in p) {
                  alert(person1Key+":"+p[person1Key]);
            }
        }
    </script>
</head>
<body>

</body>
</html>